package com.example.wechat114.service.impl;

import com.example.wechat114.commons.JsonBean;
import com.example.wechat114.entity.MForm;
import com.example.wechat114.mapper.MFormMapper;
import com.example.wechat114.service.MFormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class  MFormServiceImpl implements MFormService {
    @Autowired
    private MFormMapper mFormMapper;

    @Override
    public JsonBean selectKid(Integer k_id) {
        JsonBean jsonBean = new JsonBean(-1, "", null);
        List<MForm> mForms = mFormMapper.selectByKformId(k_id);
        if(mForms.size()>0){
            jsonBean = new JsonBean(0,"",mForms);
        }
        return jsonBean;
    }

    @Override
    public JsonBean selectMname(String mname) {
        JsonBean jsonBean = new JsonBean(-1, "", null);
        MForm mForms = mFormMapper.selectMname(mname);
        if(mForms!=null){
            jsonBean = new JsonBean(0,"",mForms);
        }
        return jsonBean;
    }


}
